
/**
 * Record pre-insert trigger.
 * Validate the record to be inserted.
 * When false is returned the record will not be inserted in the database.
 * When an exception is thrown the record will also not be inserted in the database but it will be added to databaseManager.getFailedRecords(),
 * the thrown exception can be retrieved via record.exception.getValue().
 *
 * @param {JSRecord<db:/infocom/existencias>} record record that will be inserted
 *
 * @returns {Boolean}
 *
 * @properties={typeid:24,uuid:"AA4523BD-6E42-47E3-852B-6900B0E94F52"}
 */
function onExistenciasRecordInsert(record) {
	record.exi_disponible = record.exi_cantidad + record.exi_pend_recepcion - record.exi_pend_entrega
	return true
}
